﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPFControlsLesson
{
    public class NormalViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;


		private ObservableCollection<Person> personOC = new ObservableCollection<Person>();

		public ObservableCollection<Person> PersonOC
        {
			get { return personOC; }
			set { personOC = value; 
				PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(PersonOC))); }
		}

        public NormalViewModel()
        {
            PersonOC.Add(new Person()
            {
                Name = "张三",
                Age = 25,
                Gender = "男"
            });
            PersonOC.Add(new Person()
            {
                Name = "李四",
                Age = 24,
                Gender = "女"
            });
            PersonOC.Add(new Person()
            {
                Name = "王八",
                Age = 2500,
                Gender = "中"
            });
        }
    }
}
